HomeSwiper.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. "use client";
  2. import { FC, PropsWithChildren } from "react";
  3. import { Autoplay, Pagination } from "swiper/modules";
  4. import { Swiper, SwiperSlide } from "swiper/react";
  5. interface Props {}
  6. const urls = [
  7. // "https://images.hibigwin.com/9f/202405/mqletkfLwGeZkSH.jpg",
  8. "https://images.hibigwin.com/9f/202402/jLkCmSkItvcqlid.jpg",
  9. // "https://images.hibigwin.com/9f/202404/DDnZEhXKutDVIYn.jpg",
  10. // "https://images.hibigwin.com/9f/202406/wOBQjusbGUZkBMA.jpg",
  11. // "https://images.hibigwin.com/9f/202402/jLkCmSkItvcqlid.jpg",
  12. // "https://images.hibigwin.com/9f/202405/mqletkfLwGeZkSH.jpg",
  13. // "https://images.hibigwin.com/9f/202407/LPpEiiltiXwcdYz.jpg",
  14. // "https://images.hibigwin.com/9f/202406/veFfaahiTGAyDpy.jpg",
  15. ];
  16. const HomeSwiper: FC<PropsWithChildren<Props>> = (props) => {
  17. return (
  18. <div style={{ height: "1.86rem" }}>
  19. <Swiper
  20. autoplay={{ delay: 2500 }}
  21. pagination={{ clickable: true }}
  22. spaceBetween={10}
  23. scrollbar={{ draggable: true }}
  24. slidesPerView={1}
  25. loop
  26. modules={[Pagination, Autoplay]}
  27. >
  28. {urls.map((url, index) => (
  29. <SwiperSlide key={index}>
  30. <img src={url} style={{ height: "1.86rem", width: "100%" }} alt={url} />
  31. </SwiperSlide>
  32. ))}
  33. </Swiper>
  34. </div>
  35. );
  36. };
  37. export default HomeSwiper;